<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <include file="wechat/nav" />
    <form class="form-horizontal js-ajax-form margin-top-20" action="{:url('Wechat/editPost')}" method="post">
        <div class="form-group">
            <label for="js-parent_id" class="col-sm-2 control-label">微信账号</label>
            <div class="col-md-6 col-sm-10">
                <select name="account" id="js-account" class="form-control">
                    <foreach name="accounts" key="account" item="item">
                        <if condition="$data.account eq $account">
                            <option value="{$account} " selected>{$account}</option>
                            <else/>
                            <option value="{$account}">{$account}</option>
                        </if>
                    </foreach>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label for="js-parent_id" class="col-sm-2 control-label">上级菜单</label>
            <div class="col-md-6 col-sm-10">
                <select name="parent_id" id="js-parent_id" class="form-control">
                    <option value="0">-----顶级----</option>
                    <volist name="parents" id="p">
                        <if condition="$data.parent_id eq $p.id">
                            <option value="{$p.id}" selected>{$p.name}</option>
                            <else/>
                            <option value="{$p.id}">{$p.name}</option>
                        </if>

                    </volist>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">菜单名称</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-name" name="name" value="{$data.name}">
            </div>
        </div>
        <div class="form-group">
            <label for="input-type" class="col-sm-2 control-label">菜单类型</label>
            <div class="col-md-6 col-sm-10">
                <label class="button">
                    <input name="type" value="view" class="type-check" type="radio" id="view"<if condition="$data.type eq 'view'">checked</if>>
                    <span class="icon icon-check"></span> 跳转链接
                </label>
                <label class="button">
                    <input name="type" value="click" class="type-check" type="radio" id="click"<if condition="$data.type eq 'click'">checked</if>>
                    <span class="icon icon-check"></span> 点击事件
                </label>
            </div>
        </div>
        <div class="form-group"
        <if condition="$data.type eq '点击事件'">style="display: none"</if>
        id="form-url">
        <label for="url" class="col-sm-2 control-label">链接地址</label>
        <div class="col-md-6 col-sm-10">
            <input size="50" type="text" class="form-control" id="url" name="url" placeholder="请输入菜单所指向的链接地址"
                   value="{$data.url}">
        </div>
</div>
<div class="form-group"
<if condition="$data.type eq '跳转链接'">style="display: none"</if>
id="form-key">
<label for="key" class="col-sm-2 control-label">回复文字</label>
<div class="col-md-6 col-sm-10">
    <input size="50" type="text" class="form-control" id="key" name="key" placeholder="请输入点击菜单后回复的文字"
           value="{$data.key}">
</div>
</div>

<div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
        <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('EDIT')}</button>
        <input type="hidden" name="id" value="{$data.id}">
    </div>
</div>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    $("#view").click(function () {
        $("#form-url").css('display', '');
        $("#form-key").css('display', 'none');
    });
    $("#click").click(function () {
        $("#form-url").css('display', 'none');
        $("#form-key").css('display', '');
    });
</script>
</body>
</html>
